<?php
/**
 * Created by PhpStorm.
 * User: aa
 * Date: 2019/9/3
 * Time: 19:31
 */

class Session
{
    public static function set($key, $value) {
        if(is_numeric($key)){
            return false;
        }
        $_SESSION[$key] = $value;
        if($_SESSION[$key]) {
            return true;
        } else {
            return false;
        }
    }

    public static function get($key='', $default = '') {
        if(is_numeric($key)){
            return false;
        }
        if($key=='') {
            return $_SESSION;
        } else {
            return $_SESSION[$key] ?? $default;
        }
    }

    public static function unset($key){
        if(is_numeric($key)){
            return false;
        }
        if(isset($_SESSION[$key])) {
            unset($_SESSION[$key]);
        }
    }

}